home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / misc / vpan100.zip / VPLED.H < prev    next >
C/C++ Source or Header  |  1995-01-12  |  2KB  |  84 lines

  1. //
  2. //  VIRTUAL PANELS * GRAPHIC USER UNTERFACE FOR LABORATORY WORKS
  3. //
  4. //        VPLED.H : CLASS: LED
  5. //
  6. //                       |     Written by O.Rasizade
  7. //    declarations       |       Dec 1992
  8. //                       |
  9. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  10.  
  11. #ifndef __cplusplus
  12. #error Must use C++ 
  13. #endif
  14.  
  15. #ifndef __VPLED_H
  16. #define __VPLED_H
  17.  
  18.  
  19. //++++++++++++++++++++++++++++++++++++++++++++++
  20. //++++++     COLORS   ++++++++++++++++++++++++++
  21. //++++++++++++++++++++++++++++++++++++++++++++++
  22.  
  23. struct LEDcolors {
  24.           COLORS title,on,off;
  25.           };
  26.  
  27. //-------- Default LED colors
  28. #define     TITLECOL     BLACK
  29.  
  30. const LEDcolors redLED=
  31.         {
  32.          TITLECOL,
  33.          LIGHTRED,    // LED is on
  34.          RED        // LED is off
  35.         };
  36. const LEDcolors greenLED=
  37.         {
  38.          TITLECOL,
  39.          LIGHTGREEN,    // LED is on
  40.          GREEN        // LED is off
  41.         };
  42. const LEDcolors yellowLED=
  43.         {
  44.          TITLECOL,
  45.          YELLOW,    // LED is on
  46.          BROWN        // LED is off
  47.         };
  48.  
  49. class LED
  50. {
  51. protected:
  52.  
  53.  LEDcolors  indcol;
  54.  char *title;
  55.  int indradius,indxx,indyy;
  56.  int txfont,txsize;
  57.  
  58. public:
  59.  
  60.  int on;            // if 1 then LED lighted on
  61.  
  62.   //----- Constructor ------- All coord. and sizes in VGA pixels ----
  63.  LED(
  64.        int _indx,int _indy,
  65.        char *_title,
  66.             // Hereafter are defaults
  67.        int _radius=4,            // radius of indicator
  68.        int txfont=0,int txsize=1,           // font style and size of title
  69.        LEDcolors _indcol=redLED        //colors of LED
  70.        );
  71.  
  72.  LED(int _indradius, LEDcolors _indcol=redLED)
  73.     { on=0; indcol=_indcol; indradius=xx__x(_indradius); }
  74.  
  75. virtual    void  Paint(void);
  76.  void  On(void);        // switch on or off indicator
  77.  void  Off(void);
  78.  void  Invert(void)  // Change state of indicator to opposite
  79.         { (on)?Off():On();}
  80.  
  81. };//++++++++++++++ END of class LED +++++++++++++++++++
  82.  
  83. #endif // __VPLED_H
  84.